package postpic.server.db;

import java.sql.Connection;

public class ConnectionThreadLocal {
	
	private static final ThreadLocal<Connection> LOCAL_CONNECTION = 
		new ThreadLocal<Connection>();
	
	public static void set(Connection connection) {
		LOCAL_CONNECTION.set(connection);
	}
	
	public static Connection get() {
		return LOCAL_CONNECTION.get();
	}
	
	public static Connection makeInitialValue() {
		final Connection connection = ConnectionFactory.generateNewConnection();
		LOCAL_CONNECTION.set(connection);
		return connection;
	}

}
